package com.yuntu.chapter5;

/**
 * @author MrWang-shuizhishuiheshui
 * @description
 */
public class Demo1 {
    public static void main(String[] args) {
        int num = 80;
        int num1;  num1=80;

        //1.声明数组 ( 必须指明当前数组在内存中开辟一串空间的长度个数 )
        /*
          int : 类型
          [] : 数组
          nums : 数组名(自定义)
          5 : 数组长度个数
         */
        int[] nums = new int[5];
        //2.数组赋值    数组名[下标]
        nums[0] = 80;
        nums[1] = 90;
        nums[2] = 87;
        nums[3] = 84;
        nums[4] = 70;
//        nums[6] = 60;
        //3.输出
        System.out.println(nums[3]);



        //声明数组的同时,并赋值
        String[] names = new String[]{"张三","李四","王五","赵六"};
        System.out.println(names[3]);

        //声明数组的同时,并赋值 ( 简写 )
        String[] names2 = {"张三1","李四1","王五1","赵六1"};
        System.out.println(names2[2]);
    }
}
